package reflection_generics_containers.reflection;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * @author LiuYan
 * @date 2023/7/18
 *
 */
public class JdbcBreakingParentalAssignment {

    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        // JDBC4.0以前
        // Class.forName("com.mysql.jdbc.Driver");
        //  Connection connBefore = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/zolon_billing?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true", "root", "root");
        // JDBC4.0以后：开始⽀持使⽤SPI的⽅式来注册这个Driver，具体做法就是在mysql的jar包中的 META-INF/services/java.sql.Driver ⽂件中指明当前使⽤的Driver是哪个
        // Driver在哪加载了呢？ServiceLoader.load(Driver.class)加载
        Connection connAfter = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/zolon_billing?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true", "root", "root");

    }
}
